package com.rpc.server;

import com.rpc.codec.RpcRequest;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.util.Map;

/**
 * @Description
 * @Author 顾志杰
 * @Date 2022/3/3 09:11
 */
public class RpcserverHandler extends SimpleChannelInboundHandler<RpcRequest> {
  private Map<String, Object> handlerMap;

  public RpcserverHandler(Map<String, Object> handlerMap) {
    this.handlerMap = handlerMap;
  }

  @Override
  protected void channelRead0(ChannelHandlerContext ctx, RpcRequest rpcRequest) throws Exception {
    /*解析rpcRequest*/
    /*从handlerMap中找到具体的接口(key)所绑定的实例(bean)*/
    /*通过反射cglib调用具体方法 传递相关执行参数执行逻辑即可*/
    /*返回响应信息给调用方*/
  }
}
